package online.sh.cn.fy.common.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JDBCUtil {
	public static final String name = "com.mysql.jdbc.Driver";
	public static final String url = "jdbc:mysql://10.10.4.119:3306/fy?characterEncoding=UTF-8";  
    public static final String user = "fy";  
    public static final String password = "Fy_0n1ine1212";
//	public static final String url = "jdbc:mysql://localhost:3306/fy?characterEncoding=UTF-8";  
//    public static final String user = "root";  
//    public static final String password = "yin123456";
    public static Connection conn = null;  
    
    public Connection connect(){
    	try {  
            Class.forName(name);//指定连接类型  
            conn = DriverManager.getConnection(url, user, password);//获取连接
            if(!conn.isClosed())
	         {
//	          System.out.println("connect success");
	         }
        } catch (Exception e) {  
              
        } 
    	return conn;
    }
    
    public void close() {  
        try {  
            this.conn.close();  
        } catch (SQLException e) {  
              
        }  
    }
}
